package cn.iocoder.yudao.module.jky.dal.mysql.orderdetail;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.jky.controller.admin.orderdetail.vo.OrderDetailExportReqVO;
import cn.iocoder.yudao.module.jky.controller.admin.orderdetail.vo.OrderDetailPageReqVO;
import cn.iocoder.yudao.module.jky.dal.dataobject.orderdetail.OrderDetailDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 订单详情 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface OrderDetailMapper extends BaseMapperX<OrderDetailDO> {

    default PageResult<OrderDetailDO> selectPage(OrderDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderDetailDO>()
                .eqIfPresent(OrderDetailDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderDetailDO::getOrderNum, reqVO.getOrderNum())
                .eqIfPresent(OrderDetailDO::getGoodsId, reqVO.getGoodsId())
                .likeIfPresent(OrderDetailDO::getGoodsName, reqVO.getGoodsName())
                .eqIfPresent(OrderDetailDO::getPrice, reqVO.getPrice())
                .eqIfPresent(OrderDetailDO::getNum, reqVO.getNum())
                .eqIfPresent(OrderDetailDO::getAllprice, reqVO.getAllprice())
                .eqIfPresent(OrderDetailDO::getGivePoint, reqVO.getGivePoint())
                .eqIfPresent(OrderDetailDO::getAllGivePoint, reqVO.getAllGivePoint())
                .eqIfPresent(OrderDetailDO::getProffer, reqVO.getProffer())
                .eqIfPresent(OrderDetailDO::getSku, reqVO.getSku())
                .eqIfPresent(OrderDetailDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(OrderDetailDO::getShTime, reqVO.getShTime())
                .betweenIfPresent(OrderDetailDO::getShSuccessTime, reqVO.getShSuccessTime())
                .betweenIfPresent(OrderDetailDO::getShFailTime, reqVO.getShFailTime())
                .eqIfPresent(OrderDetailDO::getReason, reqVO.getReason())
                .eqIfPresent(OrderDetailDO::getExplain, reqVO.getExplain())
                .eqIfPresent(OrderDetailDO::getImg, reqVO.getImg())
                .eqIfPresent(OrderDetailDO::getTypelist, reqVO.getTypelist())
                .eqIfPresent(OrderDetailDO::getExpressNumber, reqVO.getExpressNumber())
                .eqIfPresent(OrderDetailDO::getExpressNumber1, reqVO.getExpressNumber1())
                .eqIfPresent(OrderDetailDO::getRefuseReason, reqVO.getRefuseReason())
                .eqIfPresent(OrderDetailDO::getType, reqVO.getType())
                .eqIfPresent(OrderDetailDO::getSupplierId, reqVO.getSupplierId())
                .betweenIfPresent(OrderDetailDO::getAddtime, reqVO.getAddtime())
                .eqIfPresent(OrderDetailDO::getLogistics, reqVO.getLogistics())
                .eqIfPresent(OrderDetailDO::getOrderExpressNumber, reqVO.getOrderExpressNumber())
                .orderByDesc(OrderDetailDO::getOrderDetailId));
    }

    default List<OrderDetailDO> selectList(OrderDetailExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OrderDetailDO>()
                .eqIfPresent(OrderDetailDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderDetailDO::getOrderNum, reqVO.getOrderNum())
                .eqIfPresent(OrderDetailDO::getGoodsId, reqVO.getGoodsId())
                .likeIfPresent(OrderDetailDO::getGoodsName, reqVO.getGoodsName())
                .eqIfPresent(OrderDetailDO::getPrice, reqVO.getPrice())
                .eqIfPresent(OrderDetailDO::getNum, reqVO.getNum())
                .eqIfPresent(OrderDetailDO::getAllprice, reqVO.getAllprice())
                .eqIfPresent(OrderDetailDO::getGivePoint, reqVO.getGivePoint())
                .eqIfPresent(OrderDetailDO::getAllGivePoint, reqVO.getAllGivePoint())
                .eqIfPresent(OrderDetailDO::getProffer, reqVO.getProffer())
                .eqIfPresent(OrderDetailDO::getSku, reqVO.getSku())
                .eqIfPresent(OrderDetailDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(OrderDetailDO::getShTime, reqVO.getShTime())
                .betweenIfPresent(OrderDetailDO::getShSuccessTime, reqVO.getShSuccessTime())
                .betweenIfPresent(OrderDetailDO::getShFailTime, reqVO.getShFailTime())
                .eqIfPresent(OrderDetailDO::getReason, reqVO.getReason())
                .eqIfPresent(OrderDetailDO::getExplain, reqVO.getExplain())
                .eqIfPresent(OrderDetailDO::getImg, reqVO.getImg())
                .eqIfPresent(OrderDetailDO::getTypelist, reqVO.getTypelist())
                .eqIfPresent(OrderDetailDO::getExpressNumber, reqVO.getExpressNumber())
                .eqIfPresent(OrderDetailDO::getExpressNumber1, reqVO.getExpressNumber1())
                .eqIfPresent(OrderDetailDO::getRefuseReason, reqVO.getRefuseReason())
                .eqIfPresent(OrderDetailDO::getType, reqVO.getType())
                .eqIfPresent(OrderDetailDO::getSupplierId, reqVO.getSupplierId())
                .betweenIfPresent(OrderDetailDO::getAddtime, reqVO.getAddtime())
                .eqIfPresent(OrderDetailDO::getLogistics, reqVO.getLogistics())
                .eqIfPresent(OrderDetailDO::getOrderExpressNumber, reqVO.getOrderExpressNumber())
                .orderByDesc(OrderDetailDO::getOrderDetailId));
    }

}
